Function CreateTaskObjects(recLevel As Integer, recName As String, recDuration As Double, recStart As Date, recEnd As Date, recComplete As Double, recIsPhase As Integer) As Integer
On Error Goto ErrorHandle
Dim ProjectLib As Library
Dim libTaskBar As Master
Dim libTimeLine As Master
Dim shapeTask As Shape
Dim shapeTasksTitle As Shape
Dim dblPosS As Double
Dim dblPosE As Double
Dim dblPosC As Double
Dim dblDayWidth As Double
Dim dblCalStart As Double
Set ProjectLib = thisApp.OpenLib("Project Management/Gantt Chart Shapes.cdl")
If ProjectLib = Null Then
Exit Function
End If
Set libTaskBar = ProjectLib.MasterByName("TaskBar")
If libTaskBar = Null Then
Exit Function
End If
Set shapeTasksTitle = GetTasksTitle()
If shapeTasksTitle = Null Then
Exit Function
End If
dblDayWidth = shapeTasksTitle.CustomProp(1).Value
dblCalStart = shapeTasksTitle.CustomProp(2).Value
Dim Y As Double
Dim shp As Shape
If intPrevTaskID = 0 Then
Y = shapeTasksTitle.GPinY + shapeTasksTitle.Height
Else
Set shp = thisDoc.ActivePage.ShapeByID(intPrevTaskID)
Y = shp.GPinY + shp.Height
End If
shapeTasksTitle.Variable(3).X = 1
Set shapeTask = thisDoc.ActivePage.DropStamp(libTaskBar.Shape, shapeTasksTitle.GPinX, Y)
shapeTasksTitle.Variable(3).X = 0
libTimeLine = Null
If recIsPhase = 1 Then
shapeTask.Variable(10).X = 1
shapeTask.PropertyChanged(CDPT_VARIABLE_X, 10)
Set libTimeLine = ProjectLib.MasterByName("TimeLineS3")
ElseIf recDuration = 0 Then
Set libTimeLine = ProjectLib.MasterByName("MilestoneN1")